using UnityEngine;
using QFramework;

namespace Survivor
{
	public partial class HP : ViewController
	{
		private void OnTriggerEnter2D(Collider2D other)
		{
			if (other.GetComponent<CollectableArea>())
			{
				AudioKit.PlaySound("Hp");
				if (Global.Hp.Value >= Global.MaxHp.Value)
					return;
				
				Global.Hp.Value++;
				gameObject.DestroySelfGracefully();
			}
		}
	}
}
